<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>Title</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0,maximum-scale=1.0, user-scalable=no"/>
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
    <meta name="renderer" content="webkit">
    <link rel="stylesheet" href="/mdui/css/mdui.min.css">
    <script defer src="/mdui/js/mdui.min.js"></script>
    <script src="/js/axios.min.js"></script>
    <script src="/js/qs.min.js"></script>
    <script src="/js/common.js"></script>
    <script src="/js/vue.js"></script>


</head>
<body class="mdui-theme-primary-indigo mdui-theme-accent-pink">


<div class="mdui-container-fluid" id="app">

    <h1 class="mdui-text-color-theme">新增人员</h1>
    <div class="mdui-textfield">
        <i class="mdui-icon material-icons">account_circle</i>
        <label class="mdui-textfield-label">姓名</label>
        <input class="mdui-textfield-input" type="text" v-model="technician.name"/>
    </div>

    <div class="mdui-textfield">
        <i class="mdui-icon material-icons">account_circle</i>
        <label class="mdui-textfield-label">工号</label>
        <input class="mdui-textfield-input" type="text" v-model="technician.number"/>
    </div>

    <!-- 固定标签 -->
    <div class="mdui-textfield">
        <i class="mdui-icon material-icons">account_circle</i>
        <label class="mdui-textfield-label">电话</label>
        <input class="mdui-textfield-input" type="email" v-model="technician.phone"/>
    </div>

    <!-- 固定标签 -->
    <div class="mdui-textfield">
        <i class="mdui-icon material-icons">account_circle</i>
        <label class="mdui-textfield-label">工种</label>
        <input class="mdui-textfield-input" type="text" v-model="technician.type"/>
    </div>

    <div style="text-align: center">
        <button @click="addTechnicianr" class="mdui-btn mdui-btn-raised mdui-ripple mdui-color-green-800">新增</button>
        <a href="list.html" class="mdui-btn mdui-btn-raised mdui-ripple mdui-color-green-800">返回</a>
    </div>

</div>

<script>
    new Vue({
        el: '#app',
        data: {
            technician: {
                name: "",
                number: "",
                phone: '',
                type: ""
            }
        },

        methods: {
            addTechnicianr() {
                let _this = this;
                axios.post("/technician/addTechnician", this.technician)
                    .then(function (res) {
                        if (res.data.success) {
                            mdui.alert("新增成功");
                            _this.technician = {
                                name: "",
                                number: "",
                                type: '',
                                phone: "",
                            }
                        }

                    })
            },
        }
    })
</script>
</body>
</html>